import React, { useState } from "react";
import { Breadcrumb, Button, Layout, Menu, theme, ConfigProvider } from 'antd';
const { Header, Content, Footer, Sider } = Layout;

ConfigProvider.config({
  prefixCls: 'custom',
  theme: {
    primaryColor: '#f00',
  },
});
function getItem(label, key, children ) {
  return {
    key,
    children,
    label,
  };
}
const items = [
  getItem('Option 1', '1'),
  getItem('Option 2', '2'),
  getItem('User', 'sub1', [
    getItem('Tom', '3'),
    getItem('Bill', '4'),
    getItem('Alex', '5'),
  ]),
  getItem('Team', 'sub2', [
    getItem('Team 1', '6'), 
    getItem('Team 2', '8')
  ]),
  getItem('Files', '9'),
];
export default () => {
  const [collapsed, setCollapsed] = useState(false);
  const {
    token: { colorBgContainer, borderRadiusLG },
  } = theme.useToken();
  const option = {
    collapsed,
    collapsible: true,
    collapsedWidth: 50,
    onCollapse: (value) => setCollapsed(value)
  }
  return (
    <Layout style={{ minHeight: '100vh' }}>
      <Sider { ...option }>
      <Button type="primary">Primary Button</Button>
    <Button>Default Button</Button>
    <Button type="dashed">Dashed Button</Button>
        <Menu theme="dark" defaultSelectedKeys={['1']} mode="inline" items={items} />
      </Sider>
      <Layout>
        <Header style={{ padding: 0, background: colorBgContainer }} />
        <Content style={{ margin: '0 16px' }}>
          <Breadcrumb style={{ margin: '16px 0' }}>
            <Breadcrumb.Item>User</Breadcrumb.Item>
            <Breadcrumb.Item>Bill</Breadcrumb.Item>
          </Breadcrumb>
          <div
            style={{
              padding: 24,
              minHeight: 360,
              background: colorBgContainer,
            }}
          >
            Bill is a cat.
          </div>
        </Content>
        <Footer style={{ textAlign: 'center' }}>
          Ant Design ©{new Date().getFullYear()} Created by Ant UED
        </Footer>
      </Layout>
    </Layout>
  );
};